import type {
  RouteDetail,
  Template,
  TemplateDetail,
  TemplateMap,
  TemplateRoute,
} from '@/types/template'
import { http } from '@/utils/http'

/**
 * 获取线路地图列表
 */
export const getTemplateMapApi = () => {
  return http<TemplateMap[]>({
    method: 'GET',
    url: '/template/map',
  })
}

/**
 * 获取线路列表
 */
export const getTemplateSearchApi = (key: string) => {
  return http<Template[]>({
    method: 'GET',
    url: '/template/search',
    data: { key },
  })
}

/**
 * 获取线路详情
 */
export const getTemplateDetailApi = (id: number) => {
  return http<TemplateDetail>({
    method: 'GET',
    url: '/template/detail',
    data: { id },
  })
}
/**
 * 获取线路发班列表
 */
export const getTemplateRouteInfoApi = (id: number) => {
  return http<TemplateRoute>({
    method: 'GET',
    url: '/template/routeInfo',
    data: { id },
  })
}
/**
 * 获取线路发班详情
 */
export const getRouteGetApi = (id: number) => {
  return http<RouteDetail>({
    method: 'GET',
    url: '/route/get',
    data: { id },
  })
}
